package first;

import java.io.*;
import java.io.IOException;
import java.net.*;

public class Client {
	Socket s;
	private DataInputStream input;
	private Double port;
	Client(){
		try {
			s = new Socket("localhost",9000);
			input = new DataInputStream(s.getInputStream());
			
			port = input.readDouble();
			int a = Integer.parseInt((port+"").substring(0, 4));
			System.out.println(a);
			s.close();
			s = new Socket("localhost",a);
		} catch (UnknownHostException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		Client c = new Client();

	}

}
